const baseUrl = 'http://web.woniulab.com:8005'
function request({ url, method = 'GET', data ,header} = {}) {
	uni.showLoading({
		title: '加载中'
	});
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseUrl + url,
			method,
			data,
			header,
			success: res => {
				resolve(res.data)
			},
			fail() {
				uni.showToast({
					title: '网络错误',
					duration: 2000,
				});
			},
			complete: () => {
				uni.hideLoading()
			}
		})
	})
}

export default request;